package com.yl.flink.filter;

import com.yl.entity.MultiDataEntity;
import org.apache.flink.api.common.functions.FilterFunction;

import java.util.Optional;

/**
 * @author wlf
 * @since 2022/8/18
 */
public class NullPacketFilter implements FilterFunction<MultiDataEntity> {

    /**
     * 过滤包信息为空的流元素
     *
     * @param multiDataEntity 流元素
     * @return 返回流元素中是否包含数据包信息
     */
    @Override
    public boolean filter(MultiDataEntity multiDataEntity) throws Exception {
        return Optional.ofNullable(multiDataEntity.getPacket()).isPresent();
    }
}
